<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			#div01{
				width: 500px;
				height: 500px;
				background-color: lightblue;
			}
			.newDiv{
				background-color: lightcoral;
				float: left;
				margin-left: 10px;
			}
		</style>
	</head>
	<body>
		<div id="div01">
			
			
		</div>
		<input type="text" id="msg" />
		<button onclick="add()">添加</button>
		<script>
			function add()
			{
				var newDiv = document.createElement("div");								
				var text = document.createTextNode(msg.value);
				newDiv.className = "newDiv";
				newDiv.appendChild(text);
				div01.appendChild(newDiv)
			}
			
		</script>
		
	</body>
</html>
